home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / STRINGS / TPSTR7 / EXAM12.PAS < prev    next >
Pascal/Delphi Source File  |  1993-03-10  |  3KB  |  64 lines

  1. Program Exam12;
  2.  
  3. {**************************************************************************}
  4. {                                                                          }
  5. { Ce programme démontre les possibilités de ChrPadL et ChrPadL_.           }
  6. {                                                                          }
  7. {**************************************************************************}
  8.  
  9. Uses
  10.   TpStr;
  11.  
  12. Var
  13.   S1 ,
  14.   S2 : String;
  15.  
  16. {  ---------------------------------------------------------------         }
  17. {  Procedure   ChrPadL(Var Str: String;Fill: Char;Maxlen: Integer);        }
  18. {  ---------------------------------------------------------------         }
  19. {                                                                          }
  20. {  Effet     : remplit (au maximum) <maxlen> <Fill> à droite.              }
  21. {                                                                          }
  22. {  Usage     : Chaîne pascal.                                              }
  23. {                                                                          }
  24. {  Vitesse   : 7800/s                                                      }
  25. {                                                                          }
  26. { -------------------------------------------------------------------------}
  27.  
  28. Procedure Test1;
  29. Begin
  30.   S1 := 'Je suis à droite';
  31.   ChrPadL(S1,' ',40);
  32.   S1 := '3.14116';
  33.   ChrPadL(S1,'0',10);
  34. end;
  35.  
  36. {  ---------------------------------------------------------------         }
  37. {  Function    ChrPadL_(Str: String;Fill: Char;Maxlen: Integer):String;    }
  38. {  ---------------------------------------------------------------         }
  39. {                                                                          }
  40. {  Effet     : Idem.                                                       }
  41. {                                                                          }
  42. {  Usage     : Idem.                                                       }
  43. {                                                                          }
  44. {  Vitesse   : 7800/s                                                      }
  45. {                                                                          }
  46. {  Note      : Identique à ChrPadL mais transformé en fonction, donc <Str> }
  47. {              n'est pas modifié.                                          }
  48. { -------------------------------------------------------------------------}
  49.  
  50. Procedure Test2;
  51. Begin
  52.   S1 := 'Je suis à droite';
  53.   S2 := ChrPadL_(S1,' ',40);
  54.   S1 := '3.14116';
  55.   S2 := ChrPadL_(S1,'0',10);
  56. end;
  57.  
  58. Begin
  59.   Test1;
  60.   Test2;
  61. End.
  62.  
  63. { -------------------------------------------------------------------------}
  64.